package com.duo.controller.admin;

import com.duo.dto.OrdersConfirmDTO;
import com.duo.result.BaseResult;
import com.duo.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Xrx
 * @Description:
 * @CreateTime: 2023/7/8 19:24
 */
@RestController
@RequestMapping("/admin/order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 接受订单
     * @param ordersConfirmDTO
     * @return
     */
    @PostMapping("/confirm")
    public Object confirm(@RequestBody OrdersConfirmDTO ordersConfirmDTO) {
        log.info("接受订单, ordersConfirmDTO: {}", ordersConfirmDTO);
        orderService.confirm(ordersConfirmDTO);
        return BaseResult.success();
    }

    /**
     * 完成订单
     * @return
     */
    @PutMapping("/complete/{id}")
    public Object complete(@PathVariable("id") Long id) {
        orderService.complete(id);
        return BaseResult.success();
    }



}
